/**
 *  自定义指令
 */

export default {



    currency: {
        twoWay: true,
        bind(el, binding, vnode) {
            binding.value = (binding.value?binding.value.toFixed(2):binding.value);
        },
        update: function (el, binding) {
            var number = binding.value;
            if( typeof number == 'string'){
                number = +number.replace(/[^\d.]/g, '');
            }
            binding.value = number.toFixed(2)
            el.querySelector('input').value = number.toFixed(2)
        }
    }

}